import { MessageBox } from 'element-ui';

function confirm(txt, callback, err) {
    MessageBox.confirm(txt, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false,
        closeOnPressEscape: false
    })
        .then(() => { callback && callback() })
        .catch(() => { err && err() });
}
function icon(img) {
    return 'https://zb-prod.oss-cn-shenzhen.aliyuncs.com/resources/webResource/div/' + img + '?x-oss-process=style/icon';
}
// 返回下标
function findIndex(arr, id) {
    return arr.findIndex(x => x.id == id)
}
export default {
    confirm,
    icon,
    findIndex
}